﻿Imports System.Runtime.CompilerServices

Namespace Connection

    Public Module IDbTransactionExtenstion
        <Extension()>
        Public Function Saver(source As IDbTransaction) As Save.ModelSaver
            Return New Save.ModelSaver(source, source.Connection.GetParameterSymbol)
        End Function

        <Extension()>
        Public Function CreateCommand(source As DbTransactionWrapper, commandText As String) As IDbCommand
            Dim cmd = source.ActualTransaction.Connection.CreateCommand
            cmd.Transaction = source.ActualTransaction
            cmd.CommandText = commandText
            Return cmd
        End Function
    End Module

End Namespace